package drone.basis.express ;

import java.util.Map ;

import com.googlecode.aviator.runtime.function.AbstractFunction ;
import com.googlecode.aviator.runtime.function.FunctionUtils ;
import com.googlecode.aviator.runtime.type.AviatorDouble ;
import com.googlecode.aviator.runtime.type.AviatorObject ;

public class FuncInvert extends AbstractFunction
{

	@Override
	public AviatorObject call (
			Map < String , Object > env ,
			AviatorObject arg1
	)
	{
		byte b1 = FunctionUtils.getNumberValue ( arg1 , env ).byteValue ( ) ;
		long tmp ;
		if ( b1 == 0 )
		{
			tmp = 1 ;
		} else
		{
			tmp = 0 ;
		}
		return new AviatorDouble ( ( double ) tmp ) ;
	}

	public String getName ( )
	{
		return "invert" ;
	}
}
